Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

308
Views
Invalid attempt to spread non-iterable instance.In order to be iterable, non-array objects must have a [Symbol.iterator]() method
data(){
    return {
        tables:[]
    }
},
mounted(){
    this.getData()
},
methods:{
    getData(){
        var subscription = web3.eth.subscribe('logs', {
            address: '0x123456..',
            topics: ['0x12345...']
        }, function(error, result){
            if (!error)
                console.log(result);
        })
        .on("data", function(log){
            // this.tables return the error message typeError: Invalid attempt to spread non-iterable instance.In order to be iterable, non-array objects must have a [Symbol.iterator]() method
            this.tables = [...log]
        })
    }
}

In vue JS i can't access populate the this.tables for data what is the other way to do that?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Okay i figured it out now so the solutions is

const self = this
var subscription = web3.eth.subscribe('logs', {
            address: '0x123456..',
            topics: ['0x12345...']
        }, function(error, result){
            if (!error)
                console.log(result);
        })
        .on("data", function(log){

            self.tables.push(log)
        })
about 4 years ago · Juan Pablo Isaza Report

0

'this.tables' here mean the tables of the callback function, 'this' in callback don't target to vue data.

try this.getData(this.tables) in mounted().

and getData(tables) in methods,

then the callback should be function(log, tables){ tables = [...log]}

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!